<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>灯的开关状态</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: top;
            height: 100vh;
            margin: 0;
            background-color: #F1F3F5;
        }

        button {
            padding: 10px 20px;
            font-size: 16px;
            cursor: pointer;
        }

        .container {
            display: flex;
            width: 92%;
            padding: 0 4%; /* 内边距 */
            background-color: white;
            border-radius: 16px; /* 圆角 */
            flex-direction: column; /* 使子元素垂直排列 */
        }

        .row {
            height: 40px;
            border: 0px solid #ccc; /* 边框 */
            display: flex; /* 使用Flex布局 */
            align-items: center; /* 垂直居中对齐 */
            justify-content: space-between; /* 水平间距分布 */
            margin-bottom: 10px;
            margin-top: 10px;
        }

        .text {
            margin-right: auto; /* 文本靠左对齐 */
        }
        .light-status {
            margin-left: auto;
        }
        .light-on {
            color: #64BB5C;
        }
        .light-off {
            color: gray;
        }
        .image {
            margin-left: auto; /* 图片靠右对齐 */
        }

        .switch {
            position: relative;
            display: inline-block;
            width: 55px;
            height: 28px;
        }

        .switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }

        .slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: #ccc;
            -webkit-transition: .4s;
            transition: .4s;
            border-radius: 34px;
        }

        .slider:before {
            position: absolute;
            content: "";
            height: 20px;
            width: 20px;
            left: 4px;
            bottom: 4px;
            background-color: white;
            -webkit-transition: .4s;
            transition: .4s;
            border-radius: 50%;
        }

        input:checked + .slider {
            background-color: #2196F3;
        }

        input:checked + .slider:before {
            -webkit-transform: translateX(27px);
            -ms-transform: translateX(27px);
            transform: translateX(27px);
        }

        /* Rounded sliders */
        .slider.round {
            border-radius: 28px;
        }

        .slider.round:before {
            border-radius: 50%;
        }

    </style>
</head>
<body>
    <div class="container">
        <div class="row">
            <div class="text">开关状态</div>
            <div class="light-status light-off">关</div>
        </div>
        <div style="border-bottom: 1px solid rgba(0, 0, 0, 0.1);"></div>
        <div class="row">
            <div class="text">开关控制</div>
            <label class="switch">
                <input type="checkbox" id="toggleSwitch">
                <span class="slider round"></span>
            </label>
        </div>
    </div>
    <script src="lightScript.js"></script>
</body>
</html>
